package com.fujitsu.nanjing.tieba.dao;

import com.fujitsu.nanjing.tieba.ibator.CoreVisitStat;
import com.fujitsu.nanjing.tieba.ibator.CoreVisitStatCriteria;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class CoreVisitStatDAOImpl extends SqlMapClientDaoSupport implements CoreVisitStatDAO {

    public CoreVisitStatDAOImpl() {
        super();
    }

    public int countByExample(CoreVisitStatCriteria example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("core_visit_stat.countByExample", example);
        return count;
    }

    public int deleteByExample(CoreVisitStatCriteria example) {
        int rows = getSqlMapClientTemplate().delete("core_visit_stat.deleteByExample", example);
        return rows;
    }

    public int deleteByPrimaryKey(String statdate) {
        CoreVisitStat _key = new CoreVisitStat();
        _key.setStatdate(statdate);
        int rows = getSqlMapClientTemplate().delete("core_visit_stat.deleteByPrimaryKey", _key);
        return rows;
    }

    public void insert(CoreVisitStat record) {
        getSqlMapClientTemplate().insert("core_visit_stat.insert", record);
    }

    public void insertSelective(CoreVisitStat record) {
        getSqlMapClientTemplate().insert("core_visit_stat.insertSelective", record);
    }

    @SuppressWarnings("unchecked")
    public List<CoreVisitStat> selectByExample(CoreVisitStatCriteria example) {
        List<CoreVisitStat> list = getSqlMapClientTemplate().queryForList("core_visit_stat.selectByExample", example);
        return list;
    }

    public CoreVisitStat selectByPrimaryKey(String statdate) {
        CoreVisitStat _key = new CoreVisitStat();
        _key.setStatdate(statdate);
        CoreVisitStat record = (CoreVisitStat) getSqlMapClientTemplate().queryForObject("core_visit_stat.selectByPrimaryKey", _key);
        return record;
    }

    public int updateByExampleSelective(CoreVisitStat record, CoreVisitStatCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_visit_stat.updateByExampleSelective", parms);
        return rows;
    }

    public int updateByExample(CoreVisitStat record, CoreVisitStatCriteria example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("core_visit_stat.updateByExample", parms);
        return rows;
    }

    public int updateByPrimaryKeySelective(CoreVisitStat record) {
        int rows = getSqlMapClientTemplate().update("core_visit_stat.updateByPrimaryKeySelective", record);
        return rows;
    }

    public int updateByPrimaryKey(CoreVisitStat record) {
        int rows = getSqlMapClientTemplate().update("core_visit_stat.updateByPrimaryKey", record);
        return rows;
    }

    protected static class UpdateByExampleParms extends CoreVisitStatCriteria {
        private Object record;

        public UpdateByExampleParms(Object record, CoreVisitStatCriteria example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }
}